import java.util.*;

/**
 * @author LKQ
 * @date 2022/5/22 16:41
 * @description 动态规划，定义dp[i] 以i结束的字符串，存在元音的子字符串个数。如果A[i]是元音，那么 dp[i] = i + 1 + dp[i-1]；否则，dp[i] = dp[i-1]
 */
public class Solution {
    public static void main(String[] args) {

    }
    public long countVowels(String word) {
        int n = word.length();
        long cur = 0;
        long ans = 0;
        for(int i = 0; i < n; i++) {
            char c = word.charAt(i);
            if(isYuan(c)) {
                cur += i + 1;
            }
            ans += cur;
        }
        return ans;
    }
    public boolean isYuan(char c) {
        return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
    }
}
